import request from "@/netword/request";
import col from "element-ui/packages/col/src/col";


const fun = {};


// 分页查询所有信息
fun.getList = async (colunm) => {
    const res = await request({
        url: "/a/content/colunm/list",
        method: "post",
        params: {
            colunmName: colunm.colunmName,
            pageNo: colunm.pageNo,
            pageSize: colunm.pageSize,
        }
    })
    return res.data;
}


// 不分页查询所有信息
fun.getListAll = async (colunm) => {
    const res = await request({
        url: "/a/content/colunm/listAll",
        method: "post",
        params: {
            colunmName: colunm.colunmName
        }
    })
    return res.data;
}



//保存数据
fun.saveColunm = async (colunm) => {
    const res = await request({
        url: "/a/content/colunm/save",
        method: "put",
        params: {
            sysColunmId:colunm.sysColunmId,
            colunmName:colunm.colunmName,
            colunmIcon:colunm.colunmIcon,
            colunmDetail:colunm.colunmDetail,
            sort: colunm.sort,
            remarks: colunm.remarks,
        }
    })
    return res.data;
}



//更新数据
fun.updateColunm = async (colunm) => {
    const res = await request({
        url: "/a/content/colunm/update",
        method: "post",
        params: {
            id: colunm.id,
            sysColunmId:colunm.sysColunmId,
            colunmName:colunm.colunmName,
            colunmIcon:colunm.colunmIcon,
            colunmDetail:colunm.colunmDetail,
            sort: colunm.sort,
            remarks: colunm.remarks,
        }
    })
    return res.data;
}



//修改数据状态（正常，停用，删除）
fun.saveStatus = async (id,status) => {
    const res = await request({
        url: "/a/content/colunm/updateStatus",
        method: "post",
        params: {
            id: id,
            status:status
        }
    })
    return res.data;
}


//查询单条数据
fun.getColunm = async (id) => {
    const res = await request({
        url: "/a/content/colunm/get",
        method: "get",
        params: {
            id: id
        }
    })
    return res.data;
}


//查询单条数据
fun.getSysColunm = async () => {
    const res = await request({
        url: "/a/core/colunm/list",
        method: "post",
        params: {
        }
    })
    return res.data;
}




export default fun;